﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Globalization;

namespace Kaleidoscope
{
    public partial class UploadImage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void submitButton_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.parInput.Text))
            {
                this.Par0.Text = parInput.Text;
            }
        }

        protected void fileUploadButton_Click(object sender, EventArgs e)
        {
            if (this.fileUpload0.HasFile)
            {
                this.fileName.Text = this.fileUpload0.FileName+" size "+this.fileUpload0.FileBytes.Length;
                this.Session["uploadedFile"]= this.fileUpload0.FileBytes;
            }
        }

        protected void gradesButton_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.grades.Text))
            {
                float gradesToRotate;
                this.grades.Text=this.grades.Text.Replace(',',NumberFormatInfo.InvariantInfo.NumberDecimalSeparator[0]);
                this.grades.Text = this.grades.Text.Replace(',', NumberFormatInfo.InvariantInfo.NumberDecimalSeparator[0]);
                if (float.TryParse(this.grades.Text, System.Globalization.NumberStyles.Number,CultureInfo.InvariantCulture, out gradesToRotate))
                {
                    this.Session["gradesToRotate"]=gradesToRotate;
                }
            }
        }
    }
}
